﻿<%@ Control
    Language="C#"
    AutoEventWireup="true"
    CodeBehind="TripGrid.ascx.cs"
    Inherits="AutoStopApp.Controls.TripGrid" %>
<%@ Import
    Namespace="AutoStopData.BussinessLogic" %>
<%@ Import
    Namespace="AutoStopData.Domains" %>
<%@ Import
    Namespace="AutoStopData.Model" %>
<%@ Register
    Assembly="Telerik.Web.UI"
    Namespace="Telerik.Web.UI"
    TagPrefix="telerik" %>
<%@ Register
    TagPrefix="sc"
    Assembly="AutoStopApp"
    Namespace="AutoStopApp.ServerControls" %>
<sc:CustomGrid
    ID="rgrInstance"
    runat="server"
    CssClass="SearchResultsGrid"
    AllowPaging="True"
    PageSize="10">
    <MasterTableView
        HierarchyLoadMode="Client">
        <CommandItemSettings
            ShowAddNewRecordButton="False"
            ShowRefreshButton="False" />
        <Columns>
            <telerik:GridBoundColumn
                UniqueName="TripId"
                DataField="TripId"
                Visible="false" />
            <telerik:GridBoundColumn
                DataField="InitialCity"
                HeaderText="Miesto odkiaľ cestujete" />
            <telerik:GridBoundColumn
                DataField="DestinationCity"
                HeaderText="Miesto kam cestujete" />
            <telerik:GridBoundColumn
                DataField="DepartureTime"
                HeaderText="Odchod" />
            <telerik:GridTemplateColumn
                HeaderText="Hodnotenie vodiča"
                HeaderStyle-Width="230px">
                <ItemTemplate>
                    <div
                        class="fleft">
                        <telerik:RadRating
                            Value='<%# ((Trip)Container.DataItem).Owner.RatingAverage %>'
                            ID="UserRating"
                            runat="server"
                            AutoPostBack="true"
                            OnRate="UserRatingRate"
                            Precision="Half"
                            ReadOnly='<%# !Trips.UserCanRateTrip(((Trip)Container.DataItem).Ratings, GetCurrentUserId()) %>' />
                    </div>
                    <div
                        class="fleft">
                        <asp:Literal
                            ID="Literal1"
                            runat="server"
                            Text='[' />
                        <asp:Literal
                            ID="Literal2"
                            runat="server"
                            Text='<%# ((Trip)Container.DataItem).Owner.RatingAverage.ToString("#0.00") %>' />
                        <asp:Literal
                            ID="Literal3"
                            runat="server"
                            Text=']' />
                        <asp:Literal
                            ID="Literal4"
                            runat="server"
                            Text='hodn.' />
                        <asp:Literal
                            ID="Literal5"
                            runat="server"
                            Text='<%# ((Trip)Container.DataItem).Owner.RatingCount %>' />x
                    </div>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <NestedViewTemplate>
            <asp:Label
                ID="Label1"
                Text='Miesto odkiaľ cestujete'
                runat="server" />:
            <asp:Label
                ID="Label3"
                Text='<%#Bind("InitialCity") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label2"
                Text='Región odkiaľ cestujete'
                runat="server" />:
            <asp:Label
                ID="lblInitialRegion"
                Text='<%# Regions.GetNameByCode(((Trip)Container.DataItem).InitialRegionCode) %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label5"
                Text='Dátum a čas odchodu'
                runat="server" />:
            <asp:Label
                ID="Label6"
                Text='<%#Bind("DepartureTime") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label7"
                Text='Informácie o nástupe'
                runat="server" />:
            <asp:Label
                ID="Label8"
                Text='<%#Bind("DepartureInfo") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label9"
                Text='Miesto kam cestujete'
                runat="server" />:
            <asp:Label
                ID="Label10"
                Text='<%#Bind("DestinationCity") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label11"
                Text='Región kam cestujete'
                runat="server" />:
            <asp:Label
                ID="lblDestinationRegion"
                Text='<%# Regions.GetNameByCode(((Trip)Container.DataItem).DestinationRegionCode) %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label13"
                Text='Dátum a čas príchodu'
                runat="server" />:
            <asp:Label
                ID="Label14"
                Text='<%#Bind("ArrivalTime") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label15"
                Text='Informácie o výstupe'
                runat="server" />:
            <asp:Label
                ID="Label16"
                Text='<%#Bind("ArrivalInfo") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label17"
                Text='Počet miest'
                runat="server" />:
            <asp:Label
                ID="Label18"
                Text='<%#Bind("SeatCount") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label19"
                Text='Cena za jedno miesto'
                runat="server" />:
            <asp:Label
                ID="Label20"
                Text='<%#Bind("SeatPrice") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label21"
                Text='Poznámka'
                runat="server" />:
            <asp:Label
                ID="Label22"
                Text='<%#Bind("Note") %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label4"
                Text='Meno vodiča'
                runat="server" />:
            <asp:Label
                ID="Label12"
                Text='<%# ((Trip)Container.DataItem).Owner.Name %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label23"
                Text='E-Mail'
                runat="server" />:
            <asp:Label
                ID="Label24"
                Text='<%# ((Trip)Container.DataItem).Owner.Mail %>'
                runat="server"
                Font-Bold="true" />
            <br />
            <asp:Label
                ID="Label25"
                Text='Kontakt'
                runat="server" />:
            <asp:Label
                ID="Label26"
                Text='<%# ((Trip)Container.DataItem).Owner.Contact %>'
                runat="server"
                Font-Bold="true" />
        </NestedViewTemplate>
    </MasterTableView>
</sc:CustomGrid>
